package com.company.jdk8;

import org.junit.Test;

import javax.sound.midi.Soundbank;
import java.util.Arrays;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * @ProjectName: 复习java
 * @Package: com.company.jdk8
 * @ClassName: StreamApiTest
 * @Author: wym
 * @Date: 2020/11/9 20:26
 * @Version: 1.0
 */
public class StreamApiTest {
    @Test
    public void  test1(){
       int[] arr={1,2,4,5};

           int[] arr1=new int[]{1,2,3,45};
        IntStream stream = Arrays.stream(arr);
        stream.forEach(i-> System.out.println(i));
    }
    @Test
    public void test2(){
      //创建无限流 params 种子
        Stream.iterate("weng",t->t+2)
                .limit(10)
                .forEach(System.out::println);
    }
    @Test
    public void  test3(){
        Stream.generate(Math::random).forEach(i-> System.out.println(i));
    }
}
